const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    supplier_id: {
      type: DataTypes.INTEGER,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "供应商ID",
      field: "supplier_id"
    },
    goods_id: {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "商品ID",
      field: "goods_id",
      references: {
        key: "goods_id",
        model: "goods_model"
      }
    },
    supplier_name: {
      type: DataTypes.STRING(50),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "供应商名称",
      field: "supplier_name"
    },
    supplier_area: {
      type: DataTypes.STRING(100),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "供应商地址",
      field: "supplier_area"
    }
  };
  const options = {
    tableName: "supplier",
    comment: "",
    indexes: [{
      name: "goods_id",
      unique: false,
      type: "BTREE",
      fields: ["goods_id"]
    }]
  };
  const SupplierModel = sequelize.define("supplier_model", attributes, options);
  return SupplierModel;
};